"""
SPYTE: Strict PYthon TEster
Purpose: Check through Python source code, and ensure that all variables passed to fuctions,methods, or operators(FOM) will work. 
Pseudo-strict type checking. 
"If it walks like a duck, and talks like a duck, we should make sure they're expecting a duck!"

It statically analyzes the code, evaluating the results of known functions, and exploring unknown functions. 

Version 0.01 will explore limited functions only, and has pre-built profiles of built-in functions.

Profile: describes what a variable/object needs to do.
"""
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Built-in data types:
# int, float, long, function, class, string, boolean, complex, dict,set, tuple, list, module, method,, object, unicode

pNumber      = set(dir(int())).intersection(set(dir(float()))).intersection(set(dir(long()))).intersection(set(dir(complex)))
pInt         = set(dir(int()))
pFloat       = set(dir(float()))
pLong        = set(dir(long()))
pComplex     = set(dir(complex()))

pString      = set(dir(str()))
pUnicode     = set(dir(unicode()))

pBoolean     = set(dir(bool()))

pDict        = set(dir(dict()))
pList        = set(dir(list()))
pSet         = set(dir(set()))
pTuple       = set(dir(tuple()))

pBuiltinFunc = set(dir(dir))
def func(cls): pass
pCustomFunc  = set(dir(func))

class Klass: 
	def testfunc():
		pass

pNewBaseClass   = set(dir(object))
pOldBaseClass   = set(dir(Klass))
pBuiltinMethod  = set(object.__init__)
pCustomMethod   = set(Klass.testfunc)

pModule         = set(['__doc__', '__name__')
 

class Profile(object):
	def __init__(self, var_name):
		self.var=var_name
		self.fom = {}
		self.types={}
	def addAction(self, **kwargs):
		#take in information, and create a kind of "contract" for the variable.
		if kwargs.has_key('method'):
			self.fom[kwargs['method']]=True
		if kwargs.has_key('type'):
			self.types[kwargs['type']]=True
		if kwagrs.has_key('set'):
			for item in list(kwargs['set']):
				self.fom[item]=True
		if kwargs.has_key('methods'):
			for item in list(kwargs['methods']):
				self.fom[item]=True
				
	def checkVariable(self, potential):
		for key in self.fom.keys():
			if not potential.has_key(key):
				return False
		return True
	
		
		

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Built-in function profiles